# -*- coding: utf-8 -*-

from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit, QFormLayout
import sys

class LinEditDemo(QWidget):
    def __init__(self):
        super(LinEditDemo, self).__init__()
        self.setWindowTitle("掩码例子")

        flo = QFormLayout()
        IP = QLineEdit()
        MAC = QLineEdit()
        DATA = QLineEdit()
        # 许可证
        LICENCE = QLineEdit()

        # _类似于占位显示操作，并无实际作用
        IP.setInputMask("000.000.000.000;_")
        MAC.setInputMask("HH:HH:HH:HH;_")
        DATA.setInputMask("0000-00-00;")
        # ’#‘表示未填写内容
        LICENCE.setInputMask(">AAAAA-AAAAA-AAAAA-AAAAA;#")

        flo.addRow("IP掩码",IP)
        flo.addRow("MAC掩码",MAC)
        flo.addRow("DATA掩码",DATA)
        flo.addRow("LINCENCE掩码",LICENCE)

        self.setLayout(flo)

if __name__ == '__main__':
    app = QApplication(sys.argv)

    lin = LinEditDemo()
    lin.show()

    sys.exit(app.exec_())